import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, BaseEntity } from 'typeorm';

@Entity()
export class User extends BaseEntity{

  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    type: 'char',
    length: '100',
    unique: true
  })
  user: string;

  @Column({
    type: 'char',
    length: '200'
  })
  password: string;

  @Column({
    type: 'char',
    length: '20'
  })
  ip: string;

  @Column({
    type: 'datetime',
    nullable: true,
    default: null,
    comment: '最后登录时间'
  })
  lastLoginTime: Date;

  @Column({
    type: 'int',
    comment: '登录次数',
    default: 0
  })
  loginCount: string;

  @CreateDateColumn()
  createdAt: string;

  @UpdateDateColumn()
  updatedAt: string;
}